package org.water.garden.provider;

import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

/**
 * @author sshwsfc@gmail.com
 *
 * Base Provider For others.
 */
public abstract class BaseProvider {

    private static final String TAG = "BaseProvider";

    private static final int URI_DIR = 1;
    private static final int URI_ITEM = 2;
    
    /**
     * Get MIME subtype
     * @return mime subtype
     */
    abstract public String getSubType();
    
    private int match(Uri url) {
		// TODO Auto-generated method stub
		return 0;
	}

    public boolean onCreate() {
    	return false;
    }

    public Cursor query(Uri url, String[] projection, String selection,
            String[] selectionArgs, String sort) {
    	return null;
    }

    public String getType(Uri url) {
        switch (match(url)) {
        case URI_DIR:
            return "vnd.android-dir/vnd.water.garden-account";
        case URI_ITEM:
            return "vnd.android-item/vnd.water.garden-account";
        default:
            throw new IllegalArgumentException("Unknown URL " + url);
        }
    }

	public Uri insert(Uri url, ContentValues initialValues) {
		return null;
    }

	public int delete(Uri url, String where, String[] whereArgs) {
		return 0;
    }

    public int update(Uri url, ContentValues values, String where, String[] whereArgs) {
		return 0;
    }
}
